<?php
/*
 * 访客信息
 */
class vid extends CI_Controller {
	public function __construct(){
		parent::__construct();
			$this->load->model('vid_model');
		}

/**
 * 访客地区分部情况
 */
	public function area()
	{
		$header['title'] = '地区分部';
		$header['location1'] = '访客详情';
		$header['location2'] = '地区分部';
		$search_day = intval($this->input->get("search_day")?$this->input->get("search_day"):0);
		$search_sdate = htmlspecialchars($this->input->post("search_sdate")?$this->input->post("search_sdate"):date('Y-m-d',strtotime("-".$search_day." day")));
		$search_edate = htmlspecialchars($this->input->post("search_edate")?$this->input->post("search_edate"):date('Y-m-d'));
		$data = $this->vid_model->show($search_sdate,$search_edate,'city','地区分布统计分析图');
		$data['search_sdate'] = $search_sdate;
		$data['search_edate'] = $search_edate;
		$data['search_day'] = $search_day;
 		$this->load->view('main/header',$header);
 		$this->load->view('vid/area',$data);
 		$this->load->view('main/footer');
	}

/**
 * 访客浏览器情况
 */
	public function browser()
	{
		$header['title'] = '浏览器';
		$header['location1'] = '访客详情';
		$header['location2'] = '浏览器';
		$search_day = intval($this->input->get("search_day")?$this->input->get("search_day"):0);
		$search_sdate = htmlspecialchars($this->input->post("search_sdate")?$this->input->post("search_sdate"):date('Y-m-d',strtotime("-".$search_day." day")));
		$search_edate = htmlspecialchars($this->input->post("search_edate")?$this->input->post("search_edate"):date('Y-m-d'));
		$data = $this->vid_model->Show($search_sdate,$search_edate,'browser_Name','浏览器统计分析图');
		$data['search_sdate'] = $search_sdate;
		$data['search_edate'] = $search_edate;
		$data['search_day'] = $search_day;
 		$this->load->view('main/header',$header);
 		$this->load->view('vid/browser',$data);
 		$this->load->view('main/footer');
	}

	/**
	 * 访客浏览器情况
	 */
	public function showp()
	{
		$header['title'] = '屏幕大小';
		$header['location1'] = '访客详情';
		$header['location2'] = '屏幕大小';
		$search_day = intval($this->input->get("search_day")?$this->input->get("search_day"):0);
		$search_sdate = htmlspecialchars($this->input->post("search_sdate")?$this->input->post("search_sdate"):date('Y-m-d',strtotime("-".$search_day." day")));
		$search_edate = htmlspecialchars($this->input->post("search_edate")?$this->input->post("search_edate"):date('Y-m-d'));
		$data = $this->vid_model->Show($search_sdate,$search_edate,'fenbianlv','屏幕大小统计分析图');
		$data['search_sdate'] = $search_sdate;
		$data['search_edate'] = $search_edate;
		$data['search_day'] = $search_day;
 		$this->load->view('main/header',$header);
 		$this->load->view('vid/showp',$data);
 		$this->load->view('main/footer');
	}

	/**
	 * 访客系统情况
	 */
	public function os()
	{
		$header['title'] = '操作系统';
		$header['location1'] = '访客详情';
		$header['location2'] = '操作系统';
		$search_day = intval($this->input->get("search_day")?$this->input->get("search_day"):0);
		$search_sdate = htmlspecialchars($this->input->post("search_sdate")?$this->input->post("search_sdate"):date('Y-m-d',strtotime("-".$search_day." day")));
		$search_edate = htmlspecialchars($this->input->post("search_edate")?$this->input->post("search_edate"):date('Y-m-d'));
		$data = $this->vid_model->Show($search_sdate,$search_edate,'OS','操作系统统计分析图');
		$data['search_sdate'] = $search_sdate;
		$data['search_edate'] = $search_edate;
		$data['search_day'] = $search_day;
 		$this->load->view('main/header',$header);
 		$this->load->view('vid/os',$data);
 		$this->load->view('main/footer');
	}

	/**
	 * 当前在线用户
	 */
	public function online()
	{
		$header['title'] = '当前在线用户';
		$header['location1'] = '访客详情';
		$header['location2'] = '当前在线用户';
		$data= array();
		$data['vid_data'] = $this->vid_model->OnLine();
 		$this->load->view('main/header',$header);
 		$this->load->view('vid/online',$data);
 		$this->load->view('main/footer');
	}
}